#!/bin/bash
if [ $(whoami) != 'root' ]; then
  echo "You must be root to run this script."
  exit 1
fi

# Detect if the install media is running or not
if [ ! -d /tmp/frzr_root ]; then
  SUBVOL=""
  MOUNT_PATH=""
fi

# Force 16 bit audio, format S16LE, sample rate 96000.
cp -a ${SUBVOL}/usr/share/wireplumber ${MOUNT_PATH}/etc/
sed -i 's/--\["audio.format"\]/\["audio.format"\]/' ${MOUNT_PATH}/etc/wireplumber/main.lua.d/50-alsa-config.lua
sed -i 's/--\["audio.rate"\]/\["audio.rate"\]/' ${MOUNT_PATH}/etc/wireplumber/main.lua.d/50-alsa-config.lua
sed -i 's/44100/96000/' ${MOUNT_PATH}/etc/wireplumber/main.lua.d/50-alsa-config.lua
